{extend name='admin@main'}

{block name="button"}

{if auth("add")}
<!-- <button data-modal='{:url("sync")}' data-title="同步数据" class='layui-btn layui-btn-sm layui-btn-primary'>同步数据</button> -->
<button data-modal='{:url("add")}' data-title="添加企业" class='layui-btn layui-btn-sm layui-btn-primary'>添加企业</button>
{/if}

{if auth("remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些企业吗？" action="{:url('company/remove')}" class='layui-btn layui-btn-sm layui-btn-primary'>删除企业</button>
{/if}
{if auth("sendwx")}
<button data-modal='{:url("property/Company/sendwx")}?type=sendall'  data-csrf="{:systoken('property/Company/sendwx')}" data-rule="id={key}&type=sendall&modaltype=choiceall" data-title="发送消息" class='layui-btn layui-btn-sm layui-btn-primary sendwx'>发送通知消息</button>
{/if}
{/block}

{block name="content"}

<div class="think-box-shadow">
    {include file='index/index_search_send'}
    <table class="layui-table" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>公司名称</th>
            <th class='text-left nowrap'>公司负责人</th>
            {if $userinfo['db1']['authorize']==0 || $userinfo['db1']['authorize']==1}
            <!-- <th class='text-left nowrap'>公司信用代码</th> -->
            {/if}
            

           <!--  <th class='text-left nowrap'>公司地址</th> -->

            {if $userinfo['db1']['authorize']==1}
            <!-- <th class='text-left nowrap'>营业执照图片</th> -->
            <th class='text-center nowrap'>公司类型</th>
            <th class='text-center nowrap'>公司状态</th>
            
            {/if}
            <th class='text-left nowrap'>添加时间</th>
            <th class='text-left nowrap'></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                {if  @$vo.id}
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
                {/if}
            </td>
            <!--<td class='list-table-sort-td'>-->
            <!--    <label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.id}" class="list-sort-input"></label>-->
            <!--</td>-->
              <td class='list-table-sort-td'>
                <label>{$vo.id}</label>
            </td>
            <td class='text-left nowrap'>{$vo.name|default=''}</td>
            <td class='text-left nowrap'>{$vo.user_name|default='暂无'}</td>
            {if $userinfo['db1']['authorize']==0 || $userinfo['db1']['authorize']==1}
          <!--   <td class='text-left nowrap'>{$vo.code|default='-'}</td> -->
            {/if}
           <!--  <td class='text-left nowrap'>{$vo.address|default='-'}</td> -->
            {if $userinfo['db1']['authorize']==0 || $userinfo['db1']['authorize']==1}
<!--             <td class='text-left nowrap'>
               {php}
               {
            
                if (strstr($vo['imgurl'],'http://pc.zsicp.com')){
                    echo  "<img data-tips-image src=".$vo['imgurl'].">";
                }else{
                    echo "<img data-tips-image src="."http://devs.zsicp.com/public/upload/business_license/".$vo['imgurl'].">";   
                }
            
                }
               {/php}


            </td> -->
             <td class='text-center nowrap'>
                {eq name='vo.type' value='0'}<span class="color-red">未知</span>{/eq}
                {eq name='vo.type' value='1'}<span class="color-desc">企业租户公司</span>{/eq}
                {eq name='vo.type' value='2'}<span class="color-desc">物业公司</span>{/eq}
                {eq name='vo.type' value='3'}<span class="color-desc">企业普通公司</span>{/eq}
            </td>
            <td class='text-center nowrap'>
 {switch name="vo.status" }
    {case value='0'}<button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">
<i class="layui-icon" style="font-size: 32px;">&#xe65f;</i>待审核状态
</button>{/case}
    {case value='2'}<button type="button" class="layui-btn layui-btn-sm layui-btn-radius"><i class="layui-icon" style="font-size: 32px;">&#xe65f;</i>正常使用</button>{/case}
    {case value='3'}<button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger"><i class="layui-icon" style="font-size: 32px;color:#FF5722 ">&#xe65f;</i>套餐过期</button>{/case}  
    {default  /}-
 {/switch}


               <!--  
                {eq name='vo.status' value='0'}<span class="color-red">未审核</span>{/eq}
                {eq name='vo.status' value='1'}<span class="color-green">未通过</span>{/eq}
                {eq name='vo.status' value='2'}<span class="color-desc">已通过</span>{/eq} -->
            </td>


             {/if}
            <td class='text-left nowrap'>
                {$vo.createtime|format_datetime}
            </td>
            <td class='text-left nowrap'>
                {if auth("details")}
               <!--  <a data-dbclick class="layui-btn layui-btn-sm" data-title="详情|编辑公司信息" data-modal='{:url("details")}?id={$vo.id}'>详 情</a> -->
                {/if}

                {if auth("sendwx")}
                        
                {/if}

                {if auth("edit")}
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑公司信息" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                {/if}
                {if auth("sendwx")}
                    {if $vo.createuid}
                        <button data-modal='{:url("property/Company/sendwx")}?id={$vo.id}'  data-title="微信消息" class='layui-btn layui-btn-normal layui-btn-sm'>发送微信通知</button>
                    {/if}

                {/if}
<br>
<div class="margin-top-10"></div>
                {if auth("state") and $vo.status neq 2}
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};code#{$vo.code};status#2" data-csrf="{:systoken('state')}">人工审核-设置通过</a>
                {elseif auth("state") and $vo.status neq 1|0 }
<!--                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};code#{$vo.code};status#1" data-csrf="{:systoken('state')}">人工审核-设置未通过</a> -->
                {/if}

<!--                 {if auth("remove")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该企业吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}" action="{:url('company/remove')}">删 除</a>
                {/if} -->
<br>
<div class="margin-top-10"></div>

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>

{/block}


